
#ifndef														__MODULESERVER_H__
#	define													__MODULESERVER_H__

#	include													<map>
#	include													"Client.h"
#	include													"Order.h"
#	include													"ClientManager.h"
#	include													"Processor.h"
#	include													"IServerModule.h"

class														IServerModule;
class														Processor;

class														ModuleServer : public IServerModule
{
	enum													Operator : byte
	{
		LOGIN = 0,
		LIST = 1,
		CALL = 2,
		WHO = 3,
		OK = 4,
		KO = 5,
		WELCOME = 6,
		PING = 7,
		PONG = 8,
		REMOVE = 10
	};

public:
	ModuleServer(class Processor &);
	virtual ~ModuleServer();

private:
	std::map<Operator, void (ModuleServer::*)(IOrder *)>	_operator;
	ClientManager											_client;
	Processor												&_proc;
	std::vector<Protocol>									_proto;

public:
	virtual void											takeOrder(IOrder *, Protocol);
	virtual std::vector<Protocol>							getProtocol() const;
	virtual void											init();

private:
	void													pong(IOrder *);
	void													login(IOrder *);
	void													list(IOrder *);
	void													who(IOrder *);
	void													call(IOrder *);
};

#endif //													__MODULESERVER_H__